﻿/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __DATA_STRUCT_DATA_H__
#define __DATA_STRUCT_DATA_H__

#include "../tools/head.h"

namespace xos_http
{
    /*
    Content-Type: multipart/form-data; boundary=AaB03x

    --AaB03x
    Content-Disposition: form-data; name="submit-name"

    Larry
    --AaB03x
    Content-Disposition: form-data; name="files"
    Content-Type: multipart/mixed; boundary=BbC04y

    --BbC04y
    Content-Disposition: file; filename="file1.txt"
    Content-Type: text/plain

    ... contents of file1.txt ...
    --BbC04y
    Content-Disposition: file; filename="file2.gif"
    Content-Type: image/gif
    Content-Transfer-Encoding: binary

    ...contents of file2.gif...
    --BbC04y--
    --AaB03x--
    */
    class data : public xos_stl::mem_item< data, thread_lock >
    {
    public:
        typedef data T;

    public:
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        static int get_addr( POOL *** pppPool, LIST *** pppList );

    public:
        data();
        ~data();

    public:
        std::string m_content_type;
        std::string m_boundary;
        std::string m_content_disposition;
        std::string m_name;
        std::string m_encoding;
        bool m_bBegin;

    protected:
        int init_data();
        
    public:
        int release();
        int init();
        int term();
        
    };

} // xos_http

#endif // __DATA_STRUCT_DATA_H__
